<template>
  <a-comment v-for="msg in data" :key="msg.msgId">
    <template #actions>
      <span key="time">{{ msg.time }}</span>
    </template>
    <template #author><a>{{ msg.userName }}</a></template>
    <template #avatar>
      <a-avatar :src="'/api' + msg.userAvatar" alt="{{msg.userName}}" />
    </template>
    <template #content>
      <span v-if="msg.type == 1">
        点赞了您的帖子 <a>{{ msg.targetName }}</a>
      </span>
      <span v-if="msg.type == 2">
        点赞了您的评论：<br /> <a>{{ msg.targetName }}</a>
      </span>
      <a-badge :count="msg.checked === 1 ? 0 : 1" style="float:right;marign-right:10px" />
    </template>
  </a-comment>
</template>

<script setup>
import { get, put } from '@/common'
import { ref, reactive } from 'vue'

const data = ref([])

const getList = () => {
  get("/message/like").then((res) => {
    data.value = res.data
    console.log(data.value)
    read(1)
  })
}
const read = (type) => {
  put("/message/read/" + type).then((res) => {
    console.log("success")
  })
}
getList()
</script>
